package com.ts.api.http.platform.biz;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.gitee.apanlh.util.algorithm.encrypt.symmetric.AES;
import com.gitee.apanlh.util.base.*;
import com.gitee.apanlh.util.dataformat.JsonUtils;
import com.gitee.apanlh.util.valid.ValidParam;
import com.gitee.apanlh.web.model.vo.RequestVO;
import com.ts.api.http.platform.entity.apply.ApiPlatApplyYouXinDai;
import com.ts.api.http.platform.entity.dataexchange.ApiPlatDataExchangeYouXinDai;
import com.ts.api.module.api.convert.core.annotation.ApiPlan;
import com.ts.api.module.api.convert.core.annotation.ApiPlanConvertType;
import com.ts.api.module.api.convert.core.entity.ApiApplyParameter;
import com.ts.api.module.api.convert.core.entity.ApiBizStatus;
import com.ts.api.module.api.convert.core.entity.ApiDataExchangeParameter;
import com.ts.api.module.api.convert.core.utils.ApiFieldConverter;
import com.ts.api.module.api.convert.platform.entity.RespPlatformMultiPhoneMaskDataExchange;
import com.ts.api.module.api.convert.platform.entity.RespPlatformNoticeApply;
import com.ts.api.module.api.convert.platform.entity.RespPlatformPhoneMaskApply;
import com.ts.api.module.api.convert.platform.entity.RespPlatformPhoneMaskDataExchange;
import com.ts.api.module.api.convert.platform.handler.ApiPlatformPhoneMaskConvertHandler;
import com.ts.api.module.api.entity.ApiProtocol;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 安心分期（出）&有鑫贷 全28 8位+MD5
 * 链接：https://hdkwj09e99.feishu.cn/docx/XWSEdHDOGoIqVSxDLKrcw9RWnef?from=from_copylink
 * 密码：b9456#84
 *
 * @author gwc
 * @create 2025-08-25 上午9:30
 */
@ApiPlan(productId = "420", type = ApiPlanConvertType.PLAT_PHONE_MASK)
public class ApiPlatYouXinDaiPhoneMask implements ApiPlatformPhoneMaskConvertHandler {

    private static final String IDENTIFY = "axfqmaskcps";
    private static final String KEY = "yIYEVrIGAykC8Mfs";
    private static final String COMPANY_ID = "160104";

    @Override
    public Object dataExchange(ApiDataExchangeParameter apiDataExchangeParameter) throws Exception {
        // 创建对应的撞库实体类
        ApiPlatDataExchangeYouXinDai youXinDaiData = new ApiPlatDataExchangeYouXinDai();
        // 拓展
        ApiFieldConverter apiFieldConverter = ApiFieldConverter.create(apiDataExchangeParameter);
        // 姓名
        youXinDaiData.setCustomerName("默认姓名");
        // 掩码手机号（明文7-10位）
        youXinDaiData.setPhoneMask(apiDataExchangeParameter.getPhoneMask());
        // 性别：0男 1女
        String sex = ChooseEq.create()
                .when(apiDataExchangeParameter.getSex(), "1", "1")
                .when(apiDataExchangeParameter.getSex(), "0", "0")
                .end("0");
        youXinDaiData.setSex(sex);
        // 客户年龄
        youXinDaiData.setAge(apiFieldConverter.getAgeInt());
        // 客户IP（未获取到时默认为0.0.0.0）
        if (ValidParam.isNotEmpty(apiDataExchangeParameter.getIp())) {
            youXinDaiData.setIp(apiDataExchangeParameter.getIp());
        } else {
            youXinDaiData.setIp("0.0.0.0");
        }
        // 贷款金额（元）
        Integer money = ChooseEq.create()
                .when(apiDataExchangeParameter.getLoanAmount(), "1", 30000)
                .when(apiDataExchangeParameter.getLoanAmount(), "2", 50000)
                .when(apiDataExchangeParameter.getLoanAmount(), "3", 100000)
                .when(apiDataExchangeParameter.getLoanAmount(), "4", 200000)
                .end(30000);
        youXinDaiData.setLoanAmount(money);
        // 城市行政编码（例：北京---110000，可选，行政编码/城市简称/城市全称至少一项）
        youXinDaiData.setMapCode(apiDataExchangeParameter.getAreaCode());
        // 城市简称（例：北京，不带“市”，可选）
        youXinDaiData.setCityName(apiDataExchangeParameter.getCity().replace("市", ""));
        // 信用情况：1信用良好无逾期，2近一年无逾期，3一年内逾期少于三次，4一年内逾期超过三次，无该字段时传-2
        String overdue = ChooseEq.create()
                .when(apiDataExchangeParameter.getOverdue(), "1", "1")
                .when(apiDataExchangeParameter.getOverdue(), "2", "3")
                .when(apiDataExchangeParameter.getOverdue(), "3", "2")
                .end("-2");
        youXinDaiData.setCreditCardLimit(overdue);
        // 公积金：1缴纳6个月以上，2缴纳未满6个月，-2未购买
        String gongjijin = ChooseEq.create()
                .when(apiDataExchangeParameter.getProvidentFund(), "1", "-2")
                .when(apiDataExchangeParameter.getProvidentFund(), "2", "2")
                .when(apiDataExchangeParameter.getProvidentFund(), "3", "1")
                .when(apiDataExchangeParameter.getProvidentFund(), "4", "2")
                .end("-2");
        youXinDaiData.setAccumulationFund(gongjijin);
        // 社保：1缴纳6个月以上，2缴纳未满6个月，-2未购买
        String shebao = ChooseEq.create()
                .when(apiDataExchangeParameter.getSocialSecurity(), "1", "-2")
                .when(apiDataExchangeParameter.getSocialSecurity(), "2", "2")
                .when(apiDataExchangeParameter.getSocialSecurity(), "3", "1")
                .when(apiDataExchangeParameter.getSocialSecurity(), "4", "2")
                .end("-2");
        youXinDaiData.setSocialSecurity(shebao);
        // 芝麻分：1低于600，2在600-650，3在650-700，4高于700，-2无
        String zhima = ChooseEq.create()
                .when(apiDataExchangeParameter.getSesameCredit(), "1", "1")
                .when(apiDataExchangeParameter.getSesameCredit(), "2", "2")
                .when(apiDataExchangeParameter.getSesameCredit(), "3", "3")
                .when(apiDataExchangeParameter.getSesameCredit(), "4", "4")
                .end("-2");
        youXinDaiData.setSesameSeeds(zhima);
        // 房产情况：1全款房，2按揭房，-2无房产
        String house = ChooseEq.create()
                .when(apiDataExchangeParameter.getRealEstateInfo(), "1", "-2")
                .when(apiDataExchangeParameter.getRealEstateInfo(), "2", "1")
                .when(apiDataExchangeParameter.getRealEstateInfo(), "3", "1")
                .when(apiDataExchangeParameter.getRealEstateInfo(), "4", "2")
                .when(apiDataExchangeParameter.getRealEstateInfo(), "5", "2")
                .when(apiDataExchangeParameter.getRealEstateInfo(), "6", "1")
                .end("-2");
        youXinDaiData.setExistRoom(house);
        // 车辆情况：1全款车，2按揭车，-2无车产
        String car = ChooseEq.create()
                .when(apiDataExchangeParameter.getCarInfo(), "1", "-2")
                .when(apiDataExchangeParameter.getCarInfo(), "2", "1")
                .when(apiDataExchangeParameter.getCarInfo(), "3", "2")
                .when(apiDataExchangeParameter.getCarInfo(), "4", "1")
                .end("-2");
        youXinDaiData.setVehicleCondition(car);
        // 保险保单：1购买一年以上，2购买未满一年，-2未购买
        String insurance = ChooseEq.create()
                .when(apiDataExchangeParameter.getInsurancePolicy(), "1", "-2")
                .when(apiDataExchangeParameter.getInsurancePolicy(), "2", "2")
                .when(apiDataExchangeParameter.getInsurancePolicy(), "3", "1")
                .when(apiDataExchangeParameter.getInsurancePolicy(), "4", "2")
                .end("-2");
        youXinDaiData.setCommercialInsurance(insurance);
        // 职业：1民企员工，2外企员工，3国企员工，4公务员，5个体户，6企业主，7事业单位员工，8自由职业，9其他，无该字段传-2
        String profession = ChooseEq.create()
                .when(apiDataExchangeParameter.getCareer(), "1", "1")
                .when(apiDataExchangeParameter.getCareer(), "2", "8")
                .when(apiDataExchangeParameter.getCareer(), "3", "6")
                .when(apiDataExchangeParameter.getCareer(), "4", "4")
                .when(apiDataExchangeParameter.getCareer(), "5", "5")
                .end("-2");
        youXinDaiData.setOccupation(profession);
        // 月收入：1低于5000，2在5000-10000，3在10000-15000，4在15000-20000，5高于20000，无该字段传-2
        String monthlySalary = ChooseEq.create()
                .when(apiDataExchangeParameter.getMonthlySalary(), "1", "1")
                .when(apiDataExchangeParameter.getMonthlySalary(), "2", "2")
                .when(apiDataExchangeParameter.getMonthlySalary(), "3", "3")
                .when(apiDataExchangeParameter.getMonthlySalary(), "4", "4")
                .when(apiDataExchangeParameter.getMonthlySalary(), "5", "5")
                .end("-2");
        youXinDaiData.setMonthlyIncome(monthlySalary);
        // 贷款期限：1三个月，2六个月，3十二个月，4二十四个月，无该字段传-2
        String termNum = ChooseEq.create()
                .when(apiDataExchangeParameter.getLoanTerm(), "1", "1")
                .when(apiDataExchangeParameter.getLoanTerm(), "2", "2")
                .when(apiDataExchangeParameter.getLoanTerm(), "3", "3")
                .when(apiDataExchangeParameter.getLoanTerm(), "4", "4")
                .when(apiDataExchangeParameter.getLoanTerm(), "5", "4")
                .when(apiDataExchangeParameter.getLoanTerm(), "6", "4")
                .end("-2");
        youXinDaiData.setLengthOfMaturity(termNum);
        // 个体户月运营流水：1低于2万，2在2万~5万，3在5万~10万，4高于10万，无该字段传-2
        youXinDaiData.setMonthlyOperatingFlow("-2");
        // 企业主月开票收入：1低于10万，2在10万~50万，3在50万~150万，4高于150万，无该字段传-2
        String bizPubAccBankDetails = ChooseEq.create()
                .when(apiDataExchangeParameter.getBizPubAccBankDetails(), "1", "2")
                .when(apiDataExchangeParameter.getBizPubAccBankDetails(), "2", "3")
                .when(apiDataExchangeParameter.getBizPubAccBankDetails(), "3", "4")
                .end("-2");
        youXinDaiData.setMonthlyInvoicingRevenue(bizPubAccBankDetails);
        // 个体户营业执照：1注册一年以内，2注册一年到两年，3注册二年以上，无该字段传-2
        String businessLicense = ChooseEq.create()
                .when(apiDataExchangeParameter.getBizLicenseYear(), "1", "-2")
                .when(apiDataExchangeParameter.getBizLicenseYear(), "2", "1")
                .when(apiDataExchangeParameter.getBizLicenseYear(), "3", "2")
                .when(apiDataExchangeParameter.getBizLicenseYear(), "4", "3")
                .end("-2");
        youXinDaiData.setIndividualLicense(businessLicense);
        // 企业主营业执照：1注册一年以内，2注册一年到两年，3注册二年以上，无该字段传-2
        String companyBusinessLicense = ChooseEq.create()
                .when(apiDataExchangeParameter.getBizLicenseYear(), "1", "-2")
                .when(apiDataExchangeParameter.getBizLicenseYear(), "2", "1")
                .when(apiDataExchangeParameter.getBizLicenseYear(), "3", "2")
                .when(apiDataExchangeParameter.getBizLicenseYear(), "4", "3")
                .end("-2");
        youXinDaiData.setEntrepreneurLicense(companyBusinessLicense);
        // 请求编号：合作方需入库并与撞库时保持一致
        youXinDaiData.setRequestId(apiDataExchangeParameter.getReqId());
        // 渠道号（必传，用于区分不同计划的唯一标识，双方约定）
        youXinDaiData.setIdentify(IDENTIFY);
        //  加密
        AES aes = AES.createEcb(KEY.getBytes());
        String data = aes.encryptToBase64Str(JsonUtils.toJson(youXinDaiData));
        Map<String, Object> map = MapUtils.newHashMap(newMap -> {
            newMap.put("companyId", COMPANY_ID);
            newMap.put("data", data);
        });
        return JsonUtils.toJson(map);
    }

    @Override
    public RespPlatformMultiPhoneMaskDataExchange respDataExchange(String respJson) throws Exception {
        JSONObject jsonObject = JsonUtils.get(respJson);
        if (jsonObject == null) {
            return RespPlatformMultiPhoneMaskDataExchange.ofFail();
        }
        if (!Eq.object(jsonObject.getInteger("code"), 200)) {
            return RespPlatformMultiPhoneMaskDataExchange.ofFail();
        }
        JSONObject data = jsonObject.getJSONObject("data");
        if (ValidParam.isEmpty(data)) {
            return RespPlatformMultiPhoneMaskDataExchange.ofFail();
        }
        if (!Eq.object(data.getInteger("status"), 1)){
            return RespPlatformMultiPhoneMaskDataExchange.ofFail();
        }

        RespPlatformMultiPhoneMaskDataExchange respPlatformMultiPhoneMaskDataExchange = RespPlatformMultiPhoneMaskDataExchange.ofSuc();
        List<RespPlatformPhoneMaskDataExchange> listRespPlatformPhoneMaskDataExchange = CollUtils.newArrayList();

        JSONArray resData = data.getJSONArray("adverts");
        for (int i = 0; i < resData.size(); i++) {
            RespPlatformPhoneMaskDataExchange respPlatformPhoneMaskDataExchange = RespPlatformPhoneMaskDataExchange.of();
            JSONObject item = resData.getJSONObject(i);
            if (ValidParam.isNotNull(item)) {
                BigDecimal price = item.getBigDecimal("price");
                String companyName = item.getString("companyName");
                String productName = item.getString("productName");
                String productId = item.getString("productId");
                String logo = item.getString("logo");

                List<String> listPhoneMd5 = CollUtils.newArrayList(newList -> {
                    JSONArray jsonArray = item.getJSONArray("md5Phones");
                    IteratorUtils.array(jsonArray, (phoneMd5Result, index) -> {
                        String phoneMd5 = jsonArray.getString(index);
                        newList.add(phoneMd5);
                    });
                });
                List<ApiProtocol> protocolList = CollUtils.newArrayList(newList -> {
                    ApiProtocol protocol = new ApiProtocol();
                    protocol.setProtocolUrl(item.getString("agreementUrl"));
                    newList.add(protocol);
                });
                respPlatformPhoneMaskDataExchange.setPrice(price);
                respPlatformPhoneMaskDataExchange.setLogoPath(logo);
                respPlatformPhoneMaskDataExchange.setDisplayName(companyName);
                respPlatformPhoneMaskDataExchange.setProductName(productName);
                respPlatformPhoneMaskDataExchange.setApplyId(productId);
                respPlatformPhoneMaskDataExchange.setProtocolList(protocolList);
                respPlatformPhoneMaskDataExchange.setListPhoneMd5(listPhoneMd5);
                listRespPlatformPhoneMaskDataExchange.add(respPlatformPhoneMaskDataExchange);
            }
        }
        respPlatformMultiPhoneMaskDataExchange.setListPhoneMask(listRespPlatformPhoneMaskDataExchange);
        return respPlatformMultiPhoneMaskDataExchange;
    }

    @Override
    public Object apply(ApiApplyParameter apiApplyParameter) throws Exception {
        // 创建对应进件实体类
        ApiPlatApplyYouXinDai youXinDaiData = new ApiPlatApplyYouXinDai();
        // 拓展
        ApiFieldConverter apiFieldConverter = ApiFieldConverter.create(apiApplyParameter);
        // 姓名
        youXinDaiData.setCustomerName(apiApplyParameter.getUserName());
        // 客户电话（明文）
        youXinDaiData.setPhone(apiApplyParameter.getPhone());
        // 性别：0男 1女
        String sex = ChooseEq.create()
                .when(apiApplyParameter.getSex(), "1", "1")
                .when(apiApplyParameter.getSex(), "0", "0")
                .end("0");
        youXinDaiData.setSex(sex);
        // 客户年龄
        youXinDaiData.setAge(apiFieldConverter.getAgeInt());
        // 客户IP（未获取到时默认为0.0.0.0）
        if (ValidParam.isNotEmpty(apiApplyParameter.getIp())) {
            youXinDaiData.setIp(apiApplyParameter.getIp());
        } else {
            youXinDaiData.setIp("0.0.0.0");
        }
        // 贷款金额（元）
        Integer money = ChooseEq.create()
                .when(apiApplyParameter.getLoanAmount(), "1", 30000)
                .when(apiApplyParameter.getLoanAmount(), "2", 50000)
                .when(apiApplyParameter.getLoanAmount(), "3", 100000)
                .when(apiApplyParameter.getLoanAmount(), "4", 200000)
                .end(30000);
        youXinDaiData.setLoanAmount(money);
        // 城市行政编码（例：北京---110000，可选，行政编码/城市简称/城市全称至少选择一项）
        youXinDaiData.setMapCode(apiApplyParameter.getAreaCode());
        // 城市简称（例：北京，不带“市”，可选）
        youXinDaiData.setCityName(apiApplyParameter.getCity().replace("市", ""));
        // 信用情况：1信用良好无逾期，2近一年无逾期，3一年内逾期少于三次，4一年内逾期超过三次，无该字段时传-2
        String overdue = ChooseEq.create()
                .when(apiApplyParameter.getOverdue(), "1", "1")
                .when(apiApplyParameter.getOverdue(), "2", "3")
                .when(apiApplyParameter.getOverdue(), "3", "2")
                .end("-2");
        youXinDaiData.setCreditCardLimit(overdue);
        // 公积金：1缴纳6个月以上，2缴纳未满6个月，-2未购买
        String gongjijin = ChooseEq.create()
                .when(apiApplyParameter.getProvidentFund(), "1", "-2")
                .when(apiApplyParameter.getProvidentFund(), "2", "2")
                .when(apiApplyParameter.getProvidentFund(), "3", "1")
                .when(apiApplyParameter.getProvidentFund(), "4", "2")
                .end("-2");
        youXinDaiData.setAccumulationFund(gongjijin);
        // 社保：1缴纳6个月以上，2缴纳未满6个月，-2未购买
        String shebao = ChooseEq.create()
                .when(apiApplyParameter.getSocialSecurity(), "1", "-2")
                .when(apiApplyParameter.getSocialSecurity(), "2", "2")
                .when(apiApplyParameter.getSocialSecurity(), "3", "1")
                .when(apiApplyParameter.getSocialSecurity(), "4", "2")
                .end("-2");
        youXinDaiData.setSocialSecurity(shebao);
        // 芝麻分：1低于600，2在600-650，3在650-700，4高于700，-2无
        String zhima = ChooseEq.create()
                .when(apiApplyParameter.getSesameCredit(), "1", "1")
                .when(apiApplyParameter.getSesameCredit(), "2", "2")
                .when(apiApplyParameter.getSesameCredit(), "3", "3")
                .when(apiApplyParameter.getSesameCredit(), "4", "4")
                .end("-2");
        youXinDaiData.setSesameSeeds(zhima);
        // 房产情况：1全款房，2按揭房，-2无房产
        String house = ChooseEq.create()
                .when(apiApplyParameter.getRealEstateInfo(), "1", "-2")
                .when(apiApplyParameter.getRealEstateInfo(), "2", "1")
                .when(apiApplyParameter.getRealEstateInfo(), "3", "1")
                .when(apiApplyParameter.getRealEstateInfo(), "4", "2")
                .when(apiApplyParameter.getRealEstateInfo(), "5", "2")
                .when(apiApplyParameter.getRealEstateInfo(), "6", "1")
                .end("-2");
        youXinDaiData.setExistRoom(house);
        // 车辆情况：1全款车，2按揭车，-2无车产
        String car = ChooseEq.create()
                .when(apiApplyParameter.getCarInfo(), "1", "-2")
                .when(apiApplyParameter.getCarInfo(), "2", "1")
                .when(apiApplyParameter.getCarInfo(), "3", "2")
                .when(apiApplyParameter.getCarInfo(), "4", "1")
                .end("-2");
        youXinDaiData.setVehicleCondition(car);
        // 保险保单：1购买一年以上，2购买未满一年，-2未购买
        String insurance = ChooseEq.create()
                .when(apiApplyParameter.getInsurancePolicy(), "1", "-2")
                .when(apiApplyParameter.getInsurancePolicy(), "2", "2")
                .when(apiApplyParameter.getInsurancePolicy(), "3", "1")
                .when(apiApplyParameter.getInsurancePolicy(), "4", "2")
                .end("-2");
        youXinDaiData.setCommercialInsurance(insurance);
        // 职业：1民企员工，2外企员工，3国企员工，4公务员，5个体户，6企业主，7事业单位员工，8自由职业，9其他，无该字段时传-2
        String profession = ChooseEq.create()
                .when(apiApplyParameter.getCareer(), "1", "1")
                .when(apiApplyParameter.getCareer(), "2", "8")
                .when(apiApplyParameter.getCareer(), "3", "6")
                .when(apiApplyParameter.getCareer(), "4", "4")
                .when(apiApplyParameter.getCareer(), "5", "5")
                .end("-2");
        youXinDaiData.setOccupation(profession);
        // 月收入：1低于5000，2在5000-10000，3在10000-15000，4在15000-20000，5高于20000，无该字段时传-2
        String monthlySalary = ChooseEq.create()
                .when(apiApplyParameter.getMonthlySalary(), "1", "1")
                .when(apiApplyParameter.getMonthlySalary(), "2", "2")
                .when(apiApplyParameter.getMonthlySalary(), "3", "3")
                .when(apiApplyParameter.getMonthlySalary(), "4", "4")
                .when(apiApplyParameter.getMonthlySalary(), "5", "5")
                .end("-2");
        youXinDaiData.setMonthlyIncome(monthlySalary);
        // 贷款期限：1三个月，2六个月，3十二个月，4二十四个月，无该字段时传-2
        String termNum = ChooseEq.create()
                .when(apiApplyParameter.getLoanTerm(), "1", "1")
                .when(apiApplyParameter.getLoanTerm(), "2", "2")
                .when(apiApplyParameter.getLoanTerm(), "3", "3")
                .when(apiApplyParameter.getLoanTerm(), "4", "4")
                .when(apiApplyParameter.getLoanTerm(), "5", "4")
                .when(apiApplyParameter.getLoanTerm(), "6", "4")
                .end("-2");
        youXinDaiData.setLengthOfMaturity(termNum);
        // 个体户月运营流水：1低于2万，2在2万~5万，3在5万~10万，4高于10万，无该字段时传-2
        youXinDaiData.setMonthlyOperatingFlow("-2");
        // 企业主月开票收入：1低于10万，2在10万~50万，3在50万~150万，4高于150万，无该字段时传-2
        String bizPubAccBankDetails = ChooseEq.create()
                .when(apiApplyParameter.getBizPubAccBankDetails(), "1", "2")
                .when(apiApplyParameter.getBizPubAccBankDetails(), "2", "3")
                .when(apiApplyParameter.getBizPubAccBankDetails(), "3", "4")
                .end("-2");
        youXinDaiData.setMonthlyInvoicingRevenue(bizPubAccBankDetails);
        // 个体户营业执照：1注册一年以内，2注册一年到两年，3注册二年以上，无该字段时传-2
        String businessLicense = ChooseEq.create()
                .when(apiApplyParameter.getBizLicenseYear(), "1", "-2")
                .when(apiApplyParameter.getBizLicenseYear(), "2", "1")
                .when(apiApplyParameter.getBizLicenseYear(), "3", "2")
                .when(apiApplyParameter.getBizLicenseYear(), "4", "3")
                .end("-2");
        youXinDaiData.setIndividualLicense(businessLicense);
        // 企业主营业执照：1注册一年以内，2注册一年到两年，3注册二年以上，无该字段时传-2
        String companyBusinessLicense = ChooseEq.create()
                .when(apiApplyParameter.getBizLicenseYear(), "1", "-2")
                .when(apiApplyParameter.getBizLicenseYear(), "2", "1")
                .when(apiApplyParameter.getBizLicenseYear(), "3", "2")
                .when(apiApplyParameter.getBizLicenseYear(), "4", "3")
                .end("-2");
        youXinDaiData.setEntrepreneurLicense(companyBusinessLicense);
        // 请求编号：合作方需入库并与撞库时保持一致
        youXinDaiData.setRequestId(apiApplyParameter.getReqId());
        // 广告计划标识（多个计划合作时必传，单个计划合作时可选）
        youXinDaiData.setIdentify(IDENTIFY);
        // 授权的产品ID
        youXinDaiData.setProductId(apiApplyParameter.getApplyId());
        // 加密
        AES aes = AES.createEcb(KEY.getBytes());
        String data = aes.encryptToBase64Str(JsonUtils.toJson(youXinDaiData));
        Map<String, Object> map = MapUtils.newHashMap(newMap -> {
            newMap.put("companyId", COMPANY_ID);
            newMap.put("data", data);
        });
        return JsonUtils.toJson(map);
    }

    @Override
    public RespPlatformPhoneMaskApply respApply(String respJson) throws Exception {
        JSONObject jsonObject = JsonUtils.get(respJson);
        if (jsonObject == null) {
            return RespPlatformPhoneMaskApply.ofFail();
        }
        if (!Eq.object(jsonObject.getInteger("code"), 200)) {
            return RespPlatformPhoneMaskApply.ofFail();
        }
        // 获取响应数据
        JSONObject resData = jsonObject.getJSONObject("data");
        if (ValidParam.isEmpty(resData)) {
            return RespPlatformPhoneMaskApply.ofFail();
        }
        if (!Eq.object(resData.getInteger("status"), 1)){
            return RespPlatformPhoneMaskApply.ofFail();
        }
        return RespPlatformPhoneMaskApply.ofSuc();
    }

    @Override
    public RespPlatformNoticeApply parseApplyNotice(RequestVO requestVO) {
        return null;
    }

    @Override
    public Map<String, Object> respApplyNotice(ApiBizStatus apiBizStatus) {
        return Map.of();
    }
}
